from django.contrib import admin

from app_service.models.school_model import Teacher, Student


def get_admin_class(table_model, search_fields=None, list_filter=None):
    class AdminClass(admin.ModelAdmin):
        ...

    AdminClass.list_per_page = 10
    AdminClass.list_max_show_all = 100
    AdminClass.show_full_result_count = True

    AdminClass.list_display = [field.name for field in table_model._meta.fields]

    return AdminClass


model_tuple = (Student, Teacher)
for table_model in model_tuple:
    admin.site.register(table_model, admin_class=get_admin_class(table_model))